Skip to content

feat(core): add execution lifecycle and structured errors#35280

Closed
kitlangton wants to merge 5 commits into
event-fragmentsfrom
execution-errors
Closed

feat(core): add execution lifecycle and structured errors#35280
kitlangton wants to merge 5 commits into
event-fragmentsfrom
execution-errors

Conversation

@kitlangton

Copy link
Copy Markdown
Contributor

Closes #35016.

Summary

Replaces ambiguous V2 execution settlement and retry events with explicit lifecycle, bounded retries, and a closed structured error contract.

  • Adds durable session.execution.started, .succeeded, .failed, and .interrupted events.
  • Adds durable session.retry.scheduled and projects retry state into one Assistant across attempts.
  • Introduces the closed SessionStructuredError wire union with dot-cased type discriminators.
  • Preserves permission and typed tool failures through tool, step, and execution settlement.
  • Maps content-filter to visible failed state instead of an empty successful Assistant.
  • Types finish reasons with the shared browser-safe provider set.
  • Derives TUI status and notifications from execution lifecycle events.
  • Updates V2-backed run compatibility consumers to the explicit lifecycle.

Execution lifecycle records are historical observations of one process-local coordinator busy period. They carry no execution identity, do not define transcript boundaries, and replay never implies current liveness or recovery. /session/active remains the current-liveness authority.

Retry Policy

  • Maximum five total LLM calls.
  • Retries only pre-output rate-limit, provider-internal, and transport failures.
  • Authentication, quota, content policy, invalid request/output, route, and unknown-provider failures are terminal.
  • Midstream output and tool execution are never retried.
  • Provider retry-after delay wins over 2-second exponential backoff.
  • Every llm.stream call remains one step and consumes the agent step allowance.
  • All attempts reuse one projected Assistant; retry state clears on the next attempt or terminal lifecycle event.

Persistence

20260703210000_reset_v2_execution_errors clears V2 events, sequences, projected messages, and admitted inputs. New durable contracts start at version 1.

Verification

  • Schema: 14 focused tests
  • Core: 154 focused tests
  • TUI: 33 focused tests
  • Run compatibility: 40 focused tests
  • Client: 16 focused tests
  • SDK typecheck and generated-surface test passed
  • All affected package typechecks passed
  • Full-repo pre-push typecheck passed
  • Client and legacy SDK generators reproduced cleanly on consecutive runs
  • Migration sync check passed
  • Prettier clean; file-scoped oxlint has 0 errors
  • Two focused independent re-reviews passed after retry, interruption-race, structured-error, and TUI-bootstrap corrections

packages/client/test/contract-identity.test.ts remains a parent-branch baseline failure because the client package does not declare its test-only @opencode-ai/core dependency; the other client tests pass.

@kitlangton

Copy link
Copy Markdown
Contributor Author

Collapsed into #35272 so the Session event contract lands in one PR with one V2 history reset.

@kitlangton kitlangton closed this Jul 4, 2026
@kitlangton kitlangton deleted the execution-errors branch July 4, 2026 15:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant